From: Keir Fraser Date: Thu, 28 Aug 2008 08:44:13 +0000 (+0100) Subject: xend: Cleanup destroy and destroyDomain methods X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14113^2~19 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=309af15419b92fcc3766dc7060fbe269b6238a54;p=xen.git xend: Cleanup destroy and destroyDomain methods When domains are destroyed, _prepare_phantom_paths() method and _cleanup_phantom_devs() method are called twice as follows. destroy()@XendDomainInfo.py _prepare_phantom_paths() --------------- 1 _cleanupVm() destroyDomain() _prepare_phantom_paths() ----------- 2 xc.domain_destroy_hook() xc.domain_pause() do_FLR() xc.domain_destroy() XendDomain.remove_domain() cleanupDomain() _cleanup_phantom_devs() ------------ 1 _cleanup_phantom_devs() ---------------- 2 XendDomain.domain_delete_by_dominfo() This is a cleanup patch. It combines destroyDomain() method into destroy() method, then _prepare_phantom_paths() method and _cleanup_phantom_devs() method are called only once. Signed-off-by: Masaki Kanno --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 4ee2e23f75..271e8acc94 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -2408,29 +2408,14 @@ class XendDomainInfo: if self.domid is None: return + from xen.xend import XendDomain log.debug("XendDomainInfo.destroy: domid=%s", str(self.domid)) paths = self._prepare_phantom_paths() self._cleanupVm() if self.dompath is not None: - self.destroyDomain() - - self._cleanup_phantom_devs(paths) - - if "transient" in self.info["other_config"] \ - and bool(self.info["other_config"]["transient"]): - from xen.xend import XendDomain - XendDomain.instance().domain_delete_by_dominfo(self) - - - def destroyDomain(self): - log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid)) - - paths = self._prepare_phantom_paths() - - try: - if self.domid is not None: + try: xc.domain_destroy_hook(self.domid) xc.domain_pause(self.domid) do_FLR(self.domid) @@ -2438,15 +2423,18 @@ class XendDomainInfo: for state in DOM_STATES_OLD: self.info[state] = 0 self._stateSet(DOM_STATE_HALTED) - except: - log.exception("XendDomainInfo.destroy: xc.domain_destroy failed.") + except: + log.exception("XendDomainInfo.destroy: domain destruction failed.") - from xen.xend import XendDomain - XendDomain.instance().remove_domain(self) + XendDomain.instance().remove_domain(self) + self.cleanupDomain() - self.cleanupDomain() self._cleanup_phantom_devs(paths) + if "transient" in self.info["other_config"] \ + and bool(self.info["other_config"]["transient"]): + XendDomain.instance().domain_delete_by_dominfo(self) + def resetDomain(self): log.debug("XendDomainInfo.resetDomain(%s)", str(self.domid))